﻿<%@ Page Title="" Language="C#" MasterPageFile="~/customer/Cliente.Master" AutoEventWireup="true"
    CodeBehind="editcustomer.aspx.cs" Inherits="Loja.custumer.editcustumer" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="../scripts/colorbox/jquery.colorbox-min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../scripts/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../scripts/jquery-ui-1.8.16.custom/css/custom-theme/jquery-ui-1.8.16.custom.css" />
    <link rel="stylesheet" href="../scripts/colorbox/colorbox.css" />
    <script src="../scripts/jquery.maskedinput-1.3.min.js" type="text/javascript"></script>
    <style>
        .cadastro
        {
            border-spacing: 10px;
        }
        
        .ruim
        {
            font-family: "Verdana" , "Lucida Sans Unicode" , "Lucida Grande" , Sans-Serif;
            font-size: 10px;
            color: #B0171F;
            font-weight: bolder;
            padding-left: 20px;
            padding-top: 5px;
        }
        
        .fraca
        {
            font-family: "Verdana" , "Lucida Sans Unicode" , "Lucida Grande" , Sans-Serif;
            font-size: 10px;
            color: #FF0000;
            font-weight: bolder;
            padding-left: 20px;
            padding-top: 5px;
        }
        
        .media
        {
            font-family: "Verdana" , "Lucida Sans Unicode" , "Lucida Grande" , Sans-Serif;
            font-size: 10px;
            color: #FF8000;
            font-weight: bolder;
            padding-left: 20px;
            padding-top: 5px;
        }
        
        .forte
        {
            font-family: "Verdana" , "Lucida Sans Unicode" , "Lucida Grande" , Sans-Serif;
            font-size: 10px;
            color: #FFD700;
            font-weight: bolder;
            padding-left: 20px;
            padding-top: 5px;
        }
        
        .otima
        {
            font-family: "Verdana" , "Lucida Sans Unicode" , "Lucida Grande" , Sans-Serif;
            font-size: 10px;
            color: #00CD00;
            font-weight: bolder;
            padding-left: 20px;
            padding-top: 5px;
        }
    </style>
    <script type="text/javascript">


        jQuery(function ($) {
            $(".cpf").mask("999.999.999-99", { placeholder: " " });
            $(".rg").mask("99.999.999-*");
            $(".cep").mask("99999-999");
        });
        
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="hdCliCod" runat="server" />
    <div style="padding: 20px 20px 20px 40px;">
        <table class="cadastro">
            <tr>
                <td class="labelCadastro">
                    **E-mail:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtEmail" runat="server" Width="20em"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="reqEmail" runat="server" ErrorMessage="<strong>E-mail campo obrigatório!</strong>"
                        ControlToValidate="txtEmail" Display="None"></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender4" runat="server"
                        TargetControlID="reqEmail">
                    </ajaxToolkit:ValidatorCalloutExtender>
                    <asp:RegularExpressionValidator ID="validaEmail" runat="server" ErrorMessage="<strong>E-mail inválido</storng>"
                        ControlToValidate="txtEmail" Display="None" ValidationExpression="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{1,3})+$"></asp:RegularExpressionValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server"
                        TargetControlID="validaEmail">
                    </ajaxToolkit:ValidatorCalloutExtender>
                </td>
                <% //não faz validação dos campos na alteração  
                    if (Session["Cliente"] == null)
                   {%>
            <tr class="senha">
                <td class="labelCadastro">
                    **Senha:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtSenha" MaxLength="20" TextMode="Password" runat="server"></asp:TextBox>
                    <ajaxToolkit:PasswordStrength runat="server" ID="checkPassword" PrefixText="Segurança:"
                        TargetControlID="txtSenha" TextStrengthDescriptions="Ruim;Fraca;Média;Forte;Ótima"
                        TextStrengthDescriptionStyles="ruim;fraca;media;forte; otima" PreferredPasswordLength="10">
                    </ajaxToolkit:PasswordStrength>
                    <asp:RequiredFieldValidator ID="rqSenha" runat="server" ErrorMessage="<strong>Senha obrigatória.</strong>"
                        Display="None" ControlToValidate="txtSenha"></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender9" runat="server"
                        TargetControlID="rqSenha">
                    </ajaxToolkit:ValidatorCalloutExtender>
                </td>
            </tr>
            <tr class="senha">
                <td class="labelCadastro">
                    **Confirmação de Senha:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtConfirmSenha" MaxLength="20" TextMode="Password" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="reqConfirmaSenha" runat="server" ErrorMessage="<strong>Confirmação de senha obrigatória.</strong>"
                        Display="None" ControlToValidate="txtConfirmSenha"></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender10" runat="server"
                        TargetControlID="reqConfirmaSenha">
                    </ajaxToolkit:ValidatorCalloutExtender>
                    <asp:CompareValidator ID="cvConfirmSenha" runat="server" ErrorMessage="<strong>Confirmação errada!</strong>"
                        ControlToValidate="txtConfirmSenha" Display="None" ControlToCompare="txtSenha"
                        Operator="Equal"></asp:CompareValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender8" runat="server"
                        TargetControlID="cvConfirmSenha">
                    </ajaxToolkit:ValidatorCalloutExtender>
                </td>
            </tr>
            <% } %>
            <tr>
                <td class="labelCadastro">
                    **Nome:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtNome" runat="server" MaxLength="60" Width="28em" CssClass="upper"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="txtNome" ID="validateNome"
                        ErrorMessage="&lt;strong&gt;Nome inválido!!&lt;/strong&gt;" Display="None"></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server"
                        TargetControlID="validateNome">
                    </ajaxToolkit:ValidatorCalloutExtender>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    **CPF:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtCPF" runat="server" MaxLength="14" Width="7em" CssClass="cpf"></asp:TextBox>
                    <asp:CustomValidator ID="cvCPF" runat="server" ErrorMessage="CPF inválido!" ControlToValidate="txtCPF"
                        OnServerValidate="ValidaCPF" Display="None"></asp:CustomValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender5" runat="server"
                        TargetControlID="cvCPF">
                    </ajaxToolkit:ValidatorCalloutExtender>
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="txtCPF" ID="rqCPF"
                        ErrorMessage="<strong> CPF deve ser preenchido!</strong>" Display="None"></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server"
                        TargetControlID="rqCPF">
                    </ajaxToolkit:ValidatorCalloutExtender>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    RG.:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtRG" runat="server" MaxLength="12" Width="7em" CssClass="rg"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Data de Nascimento:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtDia" runat="server" Width="2em" MaxLength="2"></asp:TextBox>
                    <strong class="labelCadastro">/</strong>
                    <asp:TextBox ID="txtMes" runat="server" Width="2em" MaxLength="2"></asp:TextBox>
                    <strong class="labelCadastro">/</strong>
                    <asp:TextBox ID="txtAno" runat="server" Width="3em" MaxLength="4"></asp:TextBox>
                    <strong class="labelCadastro" style="font-size: 8px">dd/mm/aaaa</strong>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Sexo
                </td>
                <td colspan="3">
                    <asp:DropDownList ID="ddlSexo" runat="server" DataTextField="SexNome" DataValueField="SexCod">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Telefone 1:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtTelefone1" runat="server" Width="15em"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtTelefone1"
                        ValidationExpression="^[(]0{1}\d{2}[)]{1}\d{4}[-]{1}\d{4}$" Display="None" ErrorMessage="<strong>Telefone inválido <br />(0##)####-####</strong>"></asp:RegularExpressionValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server"
                        TargetControlID="RegularExpressionValidator1">
                    </ajaxToolkit:ValidatorCalloutExtender>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Telefone 2:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtTelefone2" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtTelefone2"
                        ValidationExpression="^[(]0{1}\d{2}[)]{1}\d{4}[-]{1}\d{4}$" Display="None" ErrorMessage="<strong>Telefone inválido <br />(0##)####-####</strong>"></asp:RegularExpressionValidator>
                    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender7" runat="server"
                        TargetControlID="RegularExpressionValidator2">
                    </ajaxToolkit:ValidatorCalloutExtender>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    CEP:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtCEP" runat="server" CssClass="cep" Width="5em"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Endereço:
                </td>
                <td>
                    <asp:TextBox ID="txtEndereco" runat="server" Width="30em"></asp:TextBox>
                </td>
                <td class="labelCadastro">
                    n.º
                </td>
                <td>
                    <asp:TextBox ID="txtNumero" runat="server" Width="5em" MaxLength="50"></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtNumero"
                        Mask="9999" PromptCharacter="">
                    </ajaxToolkit:MaskedEditExtender>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Complemento:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtComplemento" runat="server" MaxLength="10"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Bairro:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtBairro" runat="server" MaxLength="50"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Cidade:
                </td>
                <td colspan="3">
                    <asp:DropDownList ID="dpdCidade" runat="server" DataTextField="CidNom" DataValueField="CidCod">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="labelCadastro">
                    Estado:
                </td>
                <td colspan="3">
                    <asp:DropDownList ID="dpdEstado" runat="server" DataTextField="EstNom" DataValueField="EstSig">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <div style="font-size: 10px;">
                        <asp:LinkButton ID="btnGravar" CssClass="gravar" runat="server" OnClick="btnGravar_Click">Salvar</asp:LinkButton>
                        <asp:LinkButton ID="btnSair" CssClass="cancel" runat="server" CausesValidation="false"
                            OnClick="btnSair_Click">Cancelar</asp:LinkButton>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div id="dialogErro" title="ERRO !">
        <asp:Label ID="lblErro" runat="server" CssClass="erro"></asp:Label>
    </div>
</asp:Content>
